package edu.whcp.comp2301.dao.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import edu.whcp.comp2301.dao.NewsDao;
import edu.whcp.comp2301.dao.UserDao;
import edu.whcp.comp2301.mapper.NewsMapper;
import edu.whcp.comp2301.mapper.UserMapper;
import edu.whcp.comp2301.pojo.News;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class NewsDaoImpl implements NewsDao {
    @Autowired
    private NewsMapper newsMapper;

    public List<News> getNewsList(String category,String title) {
        return newsMapper.getNewsList(category, title);
    }

    @Override
    public List<News> getNews(String id){
        return newsMapper.getNews(id);
    }

    @Override
    public void addNews(News news) {
        newsMapper.addNews(news);
    }

    @Override
    public Integer delNews(String id) {
        return newsMapper.delNews(id);
    }

    @Override
    public List<News> getNewsList() {
        return newsMapper.getNewsHomepageList();
    }

    @Override
    public void editNews(News news) {
        newsMapper.editNews(news);
    }

    @Override
    public List<News> getNewsListPage(String category) {
        return newsMapper.getNewsListPage(category);
    }
}
